import random

from Spider.GetCity import City
import logging

# 配置日志记录
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')


def get_random_regions(region_list, num_regions):
    logging.info("调用地址生成算法")
    return random.choices(region_list, k=num_regions)


def res_Data(num: int):
    s = City()
    regions = s.GetData()
    random_regions = get_random_regions(regions, num)
    logging.info("地址生成成功")
    return random_regions
